package com.liucanwen.citylist.hccitylist.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.liucanwen.citylist.R;

import java.util.ArrayList;

/**
 * Created by Administrator on 2016/9/1.
 */
public class SerchAdapter extends BaseAdapter {
    private ArrayList<String> mDataList ;
    private Context mContext ;

    public SerchAdapter(Context context){
        mContext = context ;
    }

    public void setData(ArrayList<String> list){
        mDataList = list ;
    }

    @Override
    public int getCount() {
        return mDataList==null?0:mDataList.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        convertView = View.inflate(mContext, R.layout.city_item,null);
        TextView cityName = (TextView) convertView.findViewById(R.id.cityName);
        cityName.setText(mDataList.get(position));
        return convertView;
    }
}
